/**
 ****************************************************************************************
 *
 * @file ls_ble_file.h
 *
 * @brief FILE Service API
 *
 ****************************************************************************************/

#ifndef _FILE_H_
#define _FILE_H_

/*
 * INCLUDE FILES
 ****************************************************************************************
 */
#include "stdint.h"
#include "ls_ble_sdk_config.h"

/**
 * @defgroup FILE_MACRO Defines
 * @{
 */
#define FILE_CONNECTION_MAX         1
#define FILE_MAX_DATA_LEN           FILE_RX_PKT_MAX_SIZE                                        /**< Maximum length of FILE characteristic. */

/** @} */

/**
 * @defgroup FILE_ENUM Enumerations
 * @{
 */
/**@brief FILE Service event type. */
typedef enum
{
    FILE_EVT_INVALID,
    FILE_EVT_NOTIFICATION_ENABLED,
    FILE_EVT_NOTIFICATION_DISABLED,
    FILE_EVT_NOTIFICATION_COMPLETE,
    FILE_EVT_RECEIVE_CMD,
    FILE_EVT_RECEIVE_FILE_DATA,
} FILE_evt_type_t;
/** @} */

/**
 * @defgroup FILE_STRUCT Structures
 * @{
 */
/**@brief FILE Service event. */
typedef struct
{
    FILE_evt_type_t     evt_type;         /**< The FILE event. */
    uint8_t             *p_data;          /**< Pointer to data. */
    uint16_t            length;           /**< Length of data. */
} file_evt_t;
/** @} */

/**
 * @defgroup FILE_TYPEDEF Typedefs
 * @{
 */
/**@brief FILE Service event handler type. */
typedef void (*file_evt_handler_t)(file_evt_t *p_evt);

/**@brief FILE Service function type. */
typedef  void (*function)(void);
/** @} */

/**
 * @defgroup FILE_STRUCT Structures
 * @{
 */
/**@brief FILE Service initialization variable. */
typedef struct
{
    file_evt_handler_t evt_handler;    /**< Handler to handle FILE event. */
} file_profile_cb_t;
/** @} */


/**
 * @defgroup FILE_FUNCTION Functions
 * @{
 */
/**
 *****************************************************************************************
 * @brief Add an FILE Service instance in the DB
 *
 * @param[in] p_FILE_init :Pointer to FILE Service environment variable
 *
 * @return Result of service initialization.
 *****************************************************************************************
 */
int file_service_init(file_profile_cb_t *cb);


/**
 *****************************************************************************************
 * @brief Send data to peer device
 *
 * @param[in] p_data:   The Pointer of send value
 * @param[in] length:   The Lenth of send value
 *
 * @return Result of notify and indicate value 
 *****************************************************************************************
 */
int file_notify_data(uint8_t *p_data, uint16_t length);
/** @} */

#endif
/** @} */
/** @} */
